#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
using ll = long long;
int max_cnt, min_num = 2e9;
int n;
int primes[] = { 2,3,5,7,11,13,17,19,23 };
void dfs(int u, int last, int cnt, int num)
{
    if (cnt > max_cnt || cnt == max_cnt && num < min_num)
    {
        min_num = num;
        max_cnt = cnt;
    }
    if (u >= 9) return;
    for (int i = 1; i <= last; i++)
    {
        if ((ll)num * primes[u] > n) break;
        num *= primes[u];
        dfs(u + 1, i, cnt * (i + 1), num);
    }
}
int main()
{
    cin >> n;
    dfs(0, 30, 1, 1);
    cout << min_num << endl;
    return 0;
}